<?php
namespace Common\Model;
use Think\Model;
class KeywordsModel extends Model{
    protected $_validate = [
        ['msg_name', 'require', '规则名称必须填写！'],
        ['keyword', 'require', '关键词必须填写！'],
        ['keyword', '', '关键词已经存在！', 0, 'unique', 1],
        ['text_msg', 'require', '关键词必须填写！'],
    ];

    /**
     * @param $msg_type
     * @return array
     */
    public function msgList($msg_type)
    {
        $counts=$this->where("msg_type=%d and status=%d",[$msg_type,1])->count();
        $page=page($counts,10,5);
        $list=$this->where("msg_type=%d and status=%d",[$msg_type,1])->order("kid DESC")->limit($page->firstRow,$page->listRows)->select();
        $arr['list']=$list;
        $arr['page']=$page;
        return $arr;
    }

}